<script>
var doqueding='__URL__/doqueding';
var pid=0;
var dojiapei='__URL__/dojiapei';
var dowancheng='__URL__/dowancheng';
var dologinout='__APP__/Usr/dologinout';
</script>
<!--table部分-->
<div class='col-md-12 col-xs-12' style='padding-top:10px'>

    

	<div class="page-header" style="margin:0px">
      <h1 style="margin:0px"><small>联合利华合肥厂区YG厂&nbsp;&nbsp;主操：{$usross['usrnn']}&nbsp;&nbsp;日期：{$tm}</small><a></a></h1>
    </div>

    <volist name='planls' id='planv'>
        <div class="panel panel-default">
          <div class="panel-body">

            <table class='table table-hover table-striped table-bordered table-condensed' id='NBtb'>
                <thead>
                    <tr style="background-color: #337ab7;color:#fff">
                        <th>项目号</th>
                        <th>产品名称</th>
                        <th>计划量(T)</th>
                        <th>计划总量(箱)</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    
                    <tr>
                        <td>{$planv['itemcode']}</td>
                        <td>{$planv['itemnm']}</td>
                        <td>{$planv['planvolume']}</td>
                        <td>{$planv['planvolumebox']}</td>
                        <td>
                        <a class='btn btn-success' <?php if($planv['planstat']){ ?>disabled<?php } ?> onclick="queding({$planv['planid']})" >确定</a>
                        <a class='btn btn-warning' <?php if($planv['planstat']==2){ ?>disabled<?php } ?> onclick="jiapei({$planv['planid']})">加配</a>
                        <a class='btn btn-danger'  <?php if($planv['planstat']==2){ ?>disabled<?php } ?> onclick="wancheng({$planv['planid']})">完成</a>
                        </td>
                    </tr>
                    
                    
                    
                </tbody>
            </table>
            <div style="padding-bottom:10px">
            已配送：<?php echo round($planv['xiang'],1) ?>箱；
            已生产：{$planv['planrealvolume']}箱；计划：{$planv['planvolumebox']}箱<br>
            </div> 
            <div class='col-md-12 col-xs-12 nopadding'>
                <?php
                $wuliaojindu=$planv['xiang']/$planv['planvolumebox']*100;$wuliaojindu=round($wuliaojindu,1);
                ?>
                <div class='col-md-6 col-xs-6 nopadding'>
                <div class='col-md-3 col-xs-3 nopadding'>配送进度：{$wuliaojindu}%</div>
                <div class='col-md-9 col-xs-9 '>
                    <div class="progress" style="margin-bottom:0px">
                      <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="{$wuliaojindu}" aria-valuemin="0" aria-valuemax="100" style="width: {$wuliaojindu}%">
                        <span class="sr-only">20% Complete (warning)</span>
                      </div>
                    </div> 
                </div>
                </div>
                <?php
                $shengchanjindu=$planv['planrealvolume']/$planv['planvolumebox']*100;$shengchanjindu=round($shengchanjindu,1);
                ?>
                <div class='col-md-6 col-xs-6 nopadding'>
                <div class='col-md-3 col-xs-3 nopadding'>生产进度：{$shengchanjindu}%</div>
                <div class='col-md-9 col-xs-9 '>
                    <div class="progress" style="margin-bottom:0px">
                      <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="{$shengchanjindu}" aria-valuemin="0" aria-valuemax="100" style="width: {$shengchanjindu}%">
                        <span class="sr-only">10% Complete</span>
                      </div>
                    </div>
                </div>
                </div>
            </div>
            
            
            
          </div>
        </div>
    </volist>
    <div class="panel panel-default">
      <div class="panel-body">

        <div class='col-md-12 col-xs-12'>
          <div class='col-md-2 col-xs-2'><a class='btn btn-warning' href='#' onclick="loginout()"><i class='glyphicon glyphicon-off'></i> 注销</a></div>

        </div>    
        
        
      </div>
    </div>
    
</div>


<script type="text/javascript">
function queding(planid){
    var obj=new Object();
    obj['planid']=planid;
    $.ajax({
        'type': 'GET',
        'url':doqueding,
        'async':false,  
        'contentType': 'application/json',
        'data': obj,
        'dataType': 'json',
        'success': function(data) {
            
            window.location.reload();
            
            console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
}


</script>

<!--#################-->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal_jiapei" style='display: none' id='jiapei'>
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal" id="myModal_jiapei" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style='padding-top:100px'>
    <div class="modal-content">
      <div class="modal-header">
      <button type="button" class="close close_jiapei" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title">请输入加配数量</h4>
    </div>
      <div class="modal-body">
        <div class="input-group">
          <input type="telephone" class="form-control" id="jiapeishuliang" placeholder="请输入加配数量" value="0">
          <div class="input-group-addon" onclick='jiajia()'><i class='glyphicon glyphicon-triangle-top' ></i></div>
          <div class="input-group-addon" onclick='jianjian()'><i class='glyphicon glyphicon-triangle-bottom' onclick='jianjian()'></i></div>
        </div>
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-success" data-dismiss="modal"  onclick='truejiapei()'>确定</button>
        <button type="button" class="btn btn-default close_jiapei" data-dismiss="modal" >关闭</button>
        
      </div>
    </div>
  </div>
</div>

<script>

function jiapei(planid){
    pid=planid;
    clearInterval(int);
    $('#jiapei').trigger('click');
}
$(function(){
    $('.close_jiapei').click(function(){
        var int=self.setInterval("window.location.reload()",60000);
    })
})

function truejiapei(){
    var obj=new Object();
    obj['planid']=pid;
    if(!$.trim($('#jiapeishuliang').val())){ msg('请输入正确的加配数量');$('.close_jiapei').trigger('click');return; }
    obj['jiapeishuliang']=$.trim($('#jiapeishuliang').val());
    $.ajax({
        'type': 'GET',
        'url':dojiapei,
        'async':false,  
        'contentType': 'application/json',
        'data': obj,
        'dataType': 'json',
        'success': function(data) {
            
            window.location.reload();
            
            console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
}

function jiajia(){
    $('#jiapeishuliang').val(parseInt($.trim($('#jiapeishuliang').val()))+1);
}
function jianjian(){
    $('#jiapeishuliang').val(parseInt($.trim($('#jiapeishuliang').val()))-1);
}
</script>


<script type="text/javascript">
function wancheng(planid){
    var obj=new Object();
    obj['planid']=planid;
    $.ajax({
        'type': 'GET',
        'url':dowancheng,
        'async':false,  
        'contentType': 'application/json',
        'data': obj,
        'dataType': 'json',
        'success': function(data) {
            
            window.location.reload();
            
            console.log("success");
        },
        'error':function() {
            console.log("error");
        }
    });
}

function loginout(){
  $.ajax({
      'type': 'GET',
      'url':dologinout,
      'async':false,  
      'contentType': 'application/json',
      'data': {},
      'dataType': 'json',
      'success': function(data) {
        
        window.location.reload();
      },
      'error':function() {
          console.log("error");
      }
  });
}

</script>


<script type="text/javascript">
var int=self.setInterval("window.location.reload()",60000);

</script>
